<template>
	<view class="my-header" :style="{height: this.$isNotch ? '492upx' : '422upx',top: this.$isNotch ? '-492upx' : '-422upx'}" :animation="animationData" >
		<view class="header-box">
			<view class="left">
				<view class="name-not">
					<text class="name">{{ userInfo.nickname }}</text>
					<text class="sign">{{ !userInfo.motto ? '你还没拥有个性签名' : userInfo.motto }}</text>
				</view>
				<view class="fans">
					<view class="item">
						<text class="nm">{{ userInfo.popularity }}</text>
						<text class="name">人气</text>
					</view>
					<view class="item">
						<text class="nm">{{ userInfo.fans }}</text>
						<text class="name">粉丝</text>
					</view>
					<view class="item">
						<text class="nm">{{ userInfo.follow }}</text>
						<text class="name">关注</text>
					</view>
				</view>
			</view>
			<view class="right">
				<image :src="userInfo.avatar ? userInfo.avatar : avatar" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'Header',
		props: {
			userInfo: Object
		},
		data () {
			return {
				animationData: {},
				avatar: require('../../../static/img/avatar.png')
			}
		},
		mounted() {
			var animation = uni.createAnimation({
			  duration: 1000,
			    timingFunction: 'ease',
			})
			
			this.animation = animation
					
			animation.translateY(246).step()
					
			this.animationData = animation.export()	
		},
	}
</script>

<style lang="scss">
	.my-header {
		position: relative;
		width: 100%;
		height: 492upx;
		border-radius: 0px 0px 80upx 80upx;
		background-color: rgba(245, 245, 245, 100);
		border: 2upx solid rgba(255, 255, 255, 100);
		padding: 0 40upx;
		box-sizing: border-box;
		.header-box {
			position: relative;
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			position: relative;
			top: 140upx;
		}
		.left {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: flex-start;
			.name-not {
				width: 100%;
				display: flex;
				flex-direction: column;
				justify-content: flex-start;
				.name {
					color: rgba(16, 16, 16, 100);
					font-size: 52upx;
					text-align: left;
					font-family: PingFangSC-bold;
					font-weight: bolder;
				}
				.sign {
					color: rgba(213, 213, 213, 100);
					font-size: 28upx;
					text-align: left;
					font-family: PingFangSC-regular;
				}
			}
			.fans {
				margin-top: 78upx;
				display: flex;
				flex-direction: row;
				.item {
					display: flex;
					flex-direction: column;
					margin-right: 64upx;
					.nm {
						color: rgba(16, 16, 16, 100);
						font-size: 40upx;
						text-align: center;
						font-weight: bolder;
					}
					.name {
						color: rgba(213, 213, 213, 100);
						font-size: 24upx;
						text-align: center;
						font-family: PingFangSC-regular;
					}
				}
			}
		}
		.right {
			image {
				width: 176upx;
				height: 176upx;
				border-radius: 50%;
			}
		}
	}
</style>
